<script setup lang="ts">
type titleConfig = {
	title?: string;
	titleColor?: string;
	showBack?: boolean;
	showHome?: boolean;
};

const props = defineProps<{
	config: titleConfig;
}>();


function handleBack() {
	uni.navigateBack({});
}

function handleBackHome() {
	uni.reLaunch({ url: "/pages/index/Index" });
}
</script>

<template>
	<wd-navbar fixed :title="props.config.title ?? '标题'" custom-class="nav-bar-container" safeAreaInsetTop placeholder>
		<template #left>
			<wd-icon class="nav-bar-icon" name="arrow-left" @click="handleBack" v-if="props.config.showBack" />
			<wd-icon class="nav-bar-icon" name="home" @click="handleBackHome" v-if="props.config.showHome" />
		</template>

		<template #right>
			<slot name="right"></slot>
		</template>
	</wd-navbar>
</template>

<style lang="less">
.status_bar {
	height: var(--status-bar-height);
	width: 100%;
}

.nav-bar-container {
	height: 50px;
}

.nav-bar-icon {
	font-size: 60px;
}
</style>
